-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
BUG: Fix boolean value of NA is ambiguous in iloc assignment #62696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…able integer Series
…able integer Series
…able integer Series
…able integer Series
…able integer Series
|
@MarcoGorelli please review these changes when you get chance. |
|
@jbrockmendel please review these changes when you get chance. |
| values = np.asarray(original, dtype=dtype) | ||
| else: | ||
| values = np.asarray(original, dtype="object") | ||
| if not (pd.isna(values[idx]) or pd.isna(original[idx])): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check this without pd.isna? we try to avoid importing pd in files that are "high up" in the dependency hierarchy
| else: | ||
| dtype = dtype.numpy_dtype | ||
|
|
||
| if is_integer_dtype(dtype) and values.dtype.kind == "f" and len(values) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the fundamental issue is that when we get here we are implicitly assuming that values is an ndarray, while in this case it is a Series. If we called extract_array at the top of this function, then we would go through the if isinstance(values, cls): branch on L159, right?
|
I apologize for not replying earlier, I was in the hospital. I’ll continue working on this in the next 2–3 days. |
Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thank you !